﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace CrushGame
{
    namespace DelegateSpace
    {
        //Event arguments
        /// <summary>
        /// Simply the key that was pressed. Multiple events will happen for mutliple key presses
        /// </summary>
        public class InputEventArgs : EventArgs
        {
            InputCommand _inputCommand;
            bool _continued;

            /// <summary>
            /// This tells us if the key just sent was also down last frame
            /// </summary>
            public bool Continued
            {
                get { return _continued; }
                set { _continued = value; }
            }

            /// <summary>
            /// The key that was just pressed
            /// </summary>
            public InputCommand PressedKey
            {
                get { return _inputCommand; }
                set { _inputCommand = value; }
            }

            /// <summary>
            /// Constructor
            /// </summary>
            public InputEventArgs()
            {
                _inputCommand = default(InputCommand);
                _continued = false;
            }

            /// <summary>
            /// Speedy Constructor
            /// </summary>
            /// <param name="Command">The Key currently pressed</param>
            /// <param name="RemainsDown">If it was down last frame</param>
            public InputEventArgs(InputCommand Command, bool RemainsDown)
            {
                _inputCommand = Command;
                _continued = RemainsDown;
            }

        }

        /// <summary>
        /// Class for transferring information about the player spawning
        /// </summary>
        public class PlayerSpawnedEventArgs : EventArgs
        {
            Player _newPlayer;

            public Player NewPlayer
            {
              get { return _newPlayer; }
              set { _newPlayer = value; }
            }

            /// <summary>
            /// Constructor
            /// </summary>
            public PlayerSpawnedEventArgs()
            {
                _newPlayer = null;
            }

            /// <summary>
            /// Speedy constructo
            /// </summary>
            /// <param name="NewPlayer">Player that was just spawned</param>
            public PlayerSpawnedEventArgs(object NewPlayer)
            {
                _newPlayer = (Player)NewPlayer;
            }
        }

        //Delegation
        /// <summary>
        /// Delegate for input handling
        /// </summary>
        /// <param name="Sender"></param>
        /// <param name="e"></param>
        public delegate void InputEventHandler(object Sender, InputEventArgs e);

        /// <summary>
        /// Event notifying all systems that want to know that the player has spawned
        /// </summary>
        /// <param name="Sender">Sender of the event</param>
        /// <param name="?">Arguments that contain the player object</param>
        public delegate void PlayerSpawnedHandler(object Sender, PlayerSpawnedEventArgs e);
    }
}
